<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QSqlDriver Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QSqlDriver Class Reference<br /><sup><sup>[<a href="qtsql.html">QtSql</a> module]</sup></sup></h1><p>The QSqlDriver class is an abstract base class for accessing
specific SQL databases. <a href="#details">More...</a></p>

<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qsqldriver.html#DriverFeature-enum">DriverFeature</a></b> { Transactions, QuerySize, BLOB, Unicode, ..., MultipleResultSets }</li><li><div class="fn" />enum <b><a href="qsqldriver.html#IdentifierType-enum">IdentifierType</a></b> { FieldName, TableName }</li><li><div class="fn" />enum <b><a href="qsqldriver.html#StatementType-enum">StatementType</a></b> { WhereStatement, SelectStatement, UpdateStatement, InsertStatement, DeleteStatement }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qsqldriver.html#QSqlDriver">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />bool <b><a href="qsqldriver.html#beginTransaction">beginTransaction</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsqldriver.html#close">close</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsqldriver.html#commitTransaction">commitTransaction</a></b> (<i>self</i>)</li><li><div class="fn" />QSqlResult <b><a href="qsqldriver.html#createResult">createResult</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qsqldriver.html#escapeIdentifier">escapeIdentifier</a></b> (<i>self</i>, QString&#160;<i>identifier</i>, IdentifierType&#160;<i>type</i>)</li><li><div class="fn" />QString <b><a href="qsqldriver.html#formatValue">formatValue</a></b> (<i>self</i>, QSqlField&#160;<i>field</i>, bool&#160;<i>trimStrings</i>&#160;=&#160;False)</li><li><div class="fn" />QVariant <b><a href="qsqldriver.html#handle">handle</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsqldriver.html#hasFeature">hasFeature</a></b> (<i>self</i>, DriverFeature&#160;<i>f</i>)</li><li><div class="fn" />bool <b><a href="qsqldriver.html#isIdentifierEscaped">isIdentifierEscaped</a></b> (<i>self</i>, QString&#160;<i>identifier</i>, IdentifierType&#160;<i>type</i>)</li><li><div class="fn" />bool <b><a href="qsqldriver.html#isIdentifierEscapedImplementation">isIdentifierEscapedImplementation</a></b> (<i>self</i>, QString&#160;<i>identifier</i>, IdentifierType&#160;<i>type</i>)</li><li><div class="fn" />bool <b><a href="qsqldriver.html#isOpen">isOpen</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsqldriver.html#isOpenError">isOpenError</a></b> (<i>self</i>)</li><li><div class="fn" />QSqlError <b><a href="qsqldriver.html#lastError">lastError</a></b> (<i>self</i>)</li><li><div class="fn" />QSql.NumericalPrecisionPolicy <b><a href="qsqldriver.html#numericalPrecisionPolicy">numericalPrecisionPolicy</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsqldriver.html#open">open</a></b> (<i>self</i>, QString&#160;<i>db</i>, QString&#160;<i>user</i>&#160;=&#160;QString(), QString&#160;<i>password</i>&#160;=&#160;QString(), QString&#160;<i>host</i>&#160;=&#160;QString(), int&#160;<i>port</i>&#160;=&#160;-1, QString&#160;<i>options</i>&#160;=&#160;QString())</li><li><div class="fn" />QSqlIndex <b><a href="qsqldriver.html#primaryIndex">primaryIndex</a></b> (<i>self</i>, QString&#160;<i>tableName</i>)</li><li><div class="fn" />QSqlRecord <b><a href="qsqldriver.html#record">record</a></b> (<i>self</i>, QString&#160;<i>tableName</i>)</li><li><div class="fn" />bool <b><a href="qsqldriver.html#rollbackTransaction">rollbackTransaction</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsqldriver.html#setLastError">setLastError</a></b> (<i>self</i>, QSqlError&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qsqldriver.html#setNumericalPrecisionPolicy">setNumericalPrecisionPolicy</a></b> (<i>self</i>, QSql.NumericalPrecisionPolicy&#160;<i>precisionPolicy</i>)</li><li><div class="fn" /><b><a href="qsqldriver.html#setOpen">setOpen</a></b> (<i>self</i>, bool&#160;<i>o</i>)</li><li><div class="fn" /><b><a href="qsqldriver.html#setOpenError">setOpenError</a></b> (<i>self</i>, bool&#160;<i>e</i>)</li><li><div class="fn" />QString <b><a href="qsqldriver.html#sqlStatement">sqlStatement</a></b> (<i>self</i>, StatementType&#160;<i>type</i>, QString&#160;<i>tableName</i>, QSqlRecord&#160;<i>rec</i>, bool&#160;<i>preparedStatement</i>)</li><li><div class="fn" />QString <b><a href="qsqldriver.html#stripDelimiters">stripDelimiters</a></b> (<i>self</i>, QString&#160;<i>identifier</i>, IdentifierType&#160;<i>type</i>)</li><li><div class="fn" />QString <b><a href="qsqldriver.html#stripDelimitersImplementation">stripDelimitersImplementation</a></b> (<i>self</i>, QString&#160;<i>identifier</i>, IdentifierType&#160;<i>type</i>)</li><li><div class="fn" />QStringList <b><a href="qsqldriver.html#subscribedToNotifications">subscribedToNotifications</a></b> (<i>self</i>)</li><li><div class="fn" />QStringList <b><a href="qsqldriver.html#subscribedToNotificationsImplementation">subscribedToNotificationsImplementation</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsqldriver.html#subscribeToNotification">subscribeToNotification</a></b> (<i>self</i>, QString&#160;<i>name</i>)</li><li><div class="fn" />bool <b><a href="qsqldriver.html#subscribeToNotificationImplementation">subscribeToNotificationImplementation</a></b> (<i>self</i>, QString&#160;<i>name</i>)</li><li><div class="fn" />QStringList <b><a href="qsqldriver.html#tables">tables</a></b> (<i>self</i>, QSql.TableType&#160;<i>tableType</i>)</li><li><div class="fn" />bool <b><a href="qsqldriver.html#unsubscribeFromNotification">unsubscribeFromNotification</a></b> (<i>self</i>, QString&#160;<i>name</i>)</li><li><div class="fn" />bool <b><a href="qsqldriver.html#unsubscribeFromNotificationImplementation">unsubscribeFromNotificationImplementation</a></b> (<i>self</i>, QString&#160;<i>name</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qsqldriver.html#notification">notification</a></b> (const QString&amp;)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QSqlDriver class is an abstract base class for accessing
specific SQL databases.</p>
<p>This class should not be used directly. Use <a href="qsqldatabase.html">QSqlDatabase</a> instead.</p>
<p>If you want to create your own SQL drivers, you can subclass
this class and reimplement its pure virtual functions and those
virtual functions that you need. See <a href="sql-driver.html#how-to-write-your-own-database-driver">How to
Write Your Own Database Driver</a> for more information.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="DriverFeature-enum" />QSqlDriver.DriverFeature</h3><p>This enum contains a list of features a driver might support.
Use <a href="qsqldriver.html#hasFeature">hasFeature</a>() to query
whether a feature is supported or not.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.Transactions</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">Whether the driver supports SQL
transactions.</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.QuerySize</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">Whether the database is capable of reporting
the size of a query. Note that some databases do not support
returning the size (i.e. number of rows returned) of a query, in
which case <a href="qsqlquery.html#size">QSqlQuery.size</a>() will
return -1.</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.BLOB</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">Whether the driver supports Binary Large
Object fields.</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.Unicode</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">Whether the driver supports Unicode strings if
the database server does.</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.PreparedQueries</tt></td>
<td class="topAlign"><tt>4</tt></td>
<td class="topAlign">Whether the driver supports prepared query
execution.</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.NamedPlaceholders</tt></td>
<td class="topAlign"><tt>5</tt></td>
<td class="topAlign">Whether the driver supports the use of named
placeholders.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QSqlDriver.PositionalPlaceholders</tt></td>
<td class="topAlign"><tt>6</tt></td>
<td class="topAlign">Whether the driver supports the use of
positional placeholders.</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.LastInsertId</tt></td>
<td class="topAlign"><tt>7</tt></td>
<td class="topAlign">Whether the driver supports returning the Id
of the last touched row.</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.BatchOperations</tt></td>
<td class="topAlign"><tt>8</tt></td>
<td class="topAlign">Whether the driver supports batched
operations, see <a href="qsqlquery.html#execBatch">QSqlQuery.execBatch</a>()</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.SimpleLocking</tt></td>
<td class="topAlign"><tt>9</tt></td>
<td class="topAlign">Whether the driver disallows a write lock on a
table while other queries have a read lock on it.</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.LowPrecisionNumbers</tt></td>
<td class="topAlign"><tt>10</tt></td>
<td class="topAlign">Whether the driver allows fetching numerical
values with low precision.</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.EventNotifications</tt></td>
<td class="topAlign"><tt>11</tt></td>
<td class="topAlign">Whether the driver supports database event
notifications.</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.FinishQuery</tt></td>
<td class="topAlign"><tt>12</tt></td>
<td class="topAlign">Whether the driver can do any low-level
resource cleanup when <a href="qsqlquery.html#finish">QSqlQuery.finish</a>() is called.</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.MultipleResultSets</tt></td>
<td class="topAlign"><tt>13</tt></td>
<td class="topAlign">Whether the driver can access multiple result
sets returned from batched statements or stored procedures.</td>
</tr>
</table>
<p>More information about supported features can be found in the
<a href="sql-driver.html">Qt SQL driver</a> documentation.</p>
<p><b>See also</b> <a href="qsqldriver.html#hasFeature">hasFeature</a>().</p>


<h3 class="fn"><a name="IdentifierType-enum" />QSqlDriver.IdentifierType</h3><p>This enum contains a list of SQL identifier types.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.FieldName</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">A SQL field name</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.TableName</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">A SQL table name</td>
</tr>
</table>


<h3 class="fn"><a name="StatementType-enum" />QSqlDriver.StatementType</h3><p>This enum contains a list of SQL statement (or clause) types the
driver can create.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.WhereStatement</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">An SQL <tt>WHERE</tt> statement (e.g.,
<tt>WHERE f = 5</tt>).</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.SelectStatement</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">An SQL <tt>SELECT</tt> statement (e.g.,
<tt>SELECT f FROM t</tt>).</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.UpdateStatement</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">An SQL <tt>UPDATE</tt> statement (e.g.,
<tt>UPDATE TABLE t set f = 1</tt>).</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.InsertStatement</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">An SQL <tt>INSERT</tt> statement (e.g.,
<tt>INSERT INTO t (f) values (1)</tt>).</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlDriver.DeleteStatement</tt></td>
<td class="topAlign"><tt>4</tt></td>
<td class="topAlign">An SQL <tt>DELETE</tt> statement (e.g.,
<tt>DELETE FROM t</tt>).</td>
</tr>
</table>
<p><b>See also</b> <a href="qsqldriver.html#sqlStatement">sqlStatement</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QSqlDriver" />QSqlDriver.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a new driver with the given <i>parent</i>.</p>


<h3 class="fn"><a name="beginTransaction" />bool QSqlDriver.beginTransaction (<i>self</i>)</h3><p>This function is called to begin a transaction. If successful,
return true, otherwise return false. The default implementation
does nothing and returns false.</p>
<p><b>See also</b> <a href="qsqldriver.html#commitTransaction">commitTransaction</a>() and
<a href="qsqldriver.html#rollbackTransaction">rollbackTransaction</a>().</p>


<h3 class="fn"><a name="close" />QSqlDriver.close (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Derived classes must reimplement this pure virtual function in
order to close the database connection. Return true on success,
false on failure.</p>
<p><b>See also</b> <a href="qsqldriver.html#open">open</a>() and
<a href="qsqldriver.html#setOpen">setOpen</a>().</p>


<h3 class="fn"><a name="commitTransaction" />bool QSqlDriver.commitTransaction (<i>self</i>)</h3><p>This function is called to commit a transaction. If successful,
return true, otherwise return false. The default implementation
does nothing and returns false.</p>
<p><b>See also</b> <a href="qsqldriver.html#beginTransaction">beginTransaction</a>() and
<a href="qsqldriver.html#rollbackTransaction">rollbackTransaction</a>().</p>


<h3 class="fn"><a name="createResult" /><a href="qsqlresult.html">QSqlResult</a> QSqlDriver.createResult (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Creates an empty SQL result on the database. Derived classes
must reimplement this function and return a <a href="qsqlresult.html">QSqlResult</a> object appropriate for their
database to the caller.</p>


<h3 class="fn"><a name="escapeIdentifier" />QString QSqlDriver.escapeIdentifier (<i>self</i>, QString&#160;<i>identifier</i>, <a href="qsqldriver.html#IdentifierType-enum">IdentifierType</a>&#160;<i>type</i>)</h3><p>Returns the <i>identifier</i> escaped according to the database
rules. <i>identifier</i> can either be a table name or field name,
dependent on <i>type</i>.</p>
<p>The default implementation does nothing.</p>
<p><b>See also</b> <a href="qsqldriver.html#isIdentifierEscaped">isIdentifierEscaped</a>().</p>


<h3 class="fn"><a name="formatValue" />QString QSqlDriver.formatValue (<i>self</i>, <a href="qsqlfield.html">QSqlField</a>&#160;<i>field</i>, bool&#160;<i>trimStrings</i>&#160;=&#160;False)</h3><p>Returns a string representation of the <i>field</i> value for
the database. This is used, for example, when constructing INSERT
and UPDATE statements.</p>
<p>The default implementation returns the value formatted as a
string according to the following rules:</p>
<ul>
<li>If <i>field</i> is character data, the value is returned
enclosed in single quotation marks, which is appropriate for many
SQL databases. Any embedded single-quote characters are escaped
(replaced with two single-quote characters). If <i>trimStrings</i>
is true (the default is false), all trailing whitespace is trimmed
from the field.</li>
<li>If <i>field</i> is date/time data, the value is formatted in
ISO format and enclosed in single quotation marks. If the date/time
data is invalid, "NULL" is returned.</li>
<li>If <i>field</i> is <a href="qbytearray.html">bytearray</a>
data, and the driver can edit binary fields, the value is formatted
as a hexadecimal string.</li>
<li>For any other field type, toString() is called on its value and
the result of this is returned.</li>
</ul>
<p><b>See also</b> <a href="qvariant.html#toString">QVariant.toString</a>().</p>


<h3 class="fn"><a name="handle" />QVariant QSqlDriver.handle (<i>self</i>)</h3><p>Returns the low-level database handle wrapped in a <a href="qvariant.html">QVariant</a> or an invalid variant if there is no
handle.</p>
<p><b>Warning:</b> Use this with uttermost care and only if you
know what you're doing.</p>
<p><b>Warning:</b> The handle returned here can become a stale
pointer if the connection is modified (for example, if you close
the connection).</p>
<p><b>Warning:</b> The handle can be NULL if the connection is not
open yet.</p>
<p>The handle returned here is database-dependent, you should query
the type name of the variant before accessing it.</p>
<p>This example retrieves the handle for a connection to
sqlite:</p>
<pre class="cpp">
 <span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span> db <span class="operator">=</span> <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>;
 <span class="type"><a href="qvariant.html">QVariant</a></span> v <span class="operator">=</span> db<span class="operator">.</span>driver()<span class="operator">-</span><span class="operator">&gt;</span>handle();
 <span class="keyword">if</span> (v<span class="operator">.</span>isValid() <span class="operator">&amp;</span><span class="operator">&amp;</span> qstrcmp(v<span class="operator">.</span>typeName()<span class="operator">,</span> <span class="string">"sqlite3*"</span>) <span class="operator">=</span><span class="operator">=</span> <span class="number">0</span>) {
     <span class="comment">// v.data() returns a pointer to the handle</span>
     sqlite3 <span class="operator">*</span>handle <span class="operator">=</span> <span class="operator">*</span><span class="keyword">static_cast</span><span class="operator">&lt;</span>sqlite3 <span class="operator">*</span><span class="operator">*</span><span class="operator">&gt;</span>(v<span class="operator">.</span>data());
     <span class="keyword">if</span> (handle <span class="operator">!</span><span class="operator">=</span> <span class="number">0</span>) { <span class="comment">// check that it is not NULL</span>
         <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
     }
 }
</pre>
<p>This snippet returns the handle for PostgreSQL or MySQL:</p>
<pre class="cpp">
 <span class="keyword">if</span> (qstrcmp(v<span class="operator">.</span>typeName()<span class="operator">,</span> <span class="string">"PGconn*"</span>) <span class="operator">=</span><span class="operator">=</span> <span class="number">0</span>) {
     PGconn <span class="operator">*</span>handle <span class="operator">=</span> <span class="operator">*</span><span class="keyword">static_cast</span><span class="operator">&lt;</span>PGconn <span class="operator">*</span><span class="operator">*</span><span class="operator">&gt;</span>(v<span class="operator">.</span>data());
     <span class="keyword">if</span> (handle <span class="operator">!</span><span class="operator">=</span> <span class="number">0</span>) <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 }

 <span class="keyword">if</span> (qstrcmp(v<span class="operator">.</span>typeName()<span class="operator">,</span> <span class="string">"MYSQL*"</span>) <span class="operator">=</span><span class="operator">=</span> <span class="number">0</span>) {
     MYSQL <span class="operator">*</span>handle <span class="operator">=</span> <span class="operator">*</span><span class="keyword">static_cast</span><span class="operator">&lt;</span>MYSQL <span class="operator">*</span><span class="operator">*</span><span class="operator">&gt;</span>(v<span class="operator">.</span>data());
     <span class="keyword">if</span> (handle <span class="operator">!</span><span class="operator">=</span> <span class="number">0</span>) <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 }
</pre>
<p><b>See also</b> <a href="qsqlresult.html#handle">QSqlResult.handle</a>().</p>


<h3 class="fn"><a name="hasFeature" />bool QSqlDriver.hasFeature (<i>self</i>, <a href="qsqldriver.html#DriverFeature-enum">DriverFeature</a>&#160;<i>f</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns true if the driver supports feature <i>feature</i>;
otherwise returns false.</p>
<p>Note that some databases need to be <a href="qsqldriver.html#open">open</a>() before this can be
determined.</p>
<p><b>See also</b> <a href="qsqldriver.html#DriverFeature-enum">DriverFeature</a>.</p>


<h3 class="fn"><a name="isIdentifierEscaped" />bool QSqlDriver.isIdentifierEscaped (<i>self</i>, QString&#160;<i>identifier</i>, <a href="qsqldriver.html#IdentifierType-enum">IdentifierType</a>&#160;<i>type</i>)</h3><p>Returns whether <i>identifier</i> is escaped according to the
database rules. <i>identifier</i> can either be a table name or
field name, dependent on <i>type</i>.</p>
<p><b>Warning:</b> Because of binary compatibility constraints,
this function is not virtual. If you want to provide your own
implementation in your <a href="qsqldriver.html">QSqlDriver</a>
subclass, reimplement the <a href="qsqldriver.html#isIdentifierEscapedImplementation">isIdentifierEscapedImplementation</a>()
slot in your subclass instead. The isIdentifierEscapedFunction()
will dynamically detect the slot and call it.</p>
<p><b>See also</b> <a href="qsqldriver.html#stripDelimiters">stripDelimiters</a>() and
<a href="qsqldriver.html#escapeIdentifier">escapeIdentifier</a>().</p>


<h3 class="fn"><a name="isIdentifierEscapedImplementation" />bool QSqlDriver.isIdentifierEscapedImplementation (<i>self</i>, QString&#160;<i>identifier</i>, <a href="qsqldriver.html#IdentifierType-enum">IdentifierType</a>&#160;<i>type</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>bool isIdentifierEscapedImplementation(const QString&amp;,QSqlDriver::IdentifierType) const</tt>.</p><p>This slot returns whether <i>identifier</i> is escaped according
to the database rules. <i>identifier</i> can either be a table name
or field name, dependent on <i>type</i>.</p>
<p>Because of binary compatibility constraints, <a href="qsqldriver.html#isIdentifierEscaped">isIdentifierEscaped</a>()
function (introduced in Qt 4.5) is not virtual. Instead, <a href="qsqldriver.html#isIdentifierEscaped">isIdentifierEscaped</a>()
will dynamically detect and call <i>this</i> slot. The default
implementation assumes the escape/delimiter character is a double
quote. Reimplement this slot in your own <a href="qsqldriver.html">QSqlDriver</a> if your database engine uses a
different delimiter character.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qsqldriver.html#isIdentifierEscaped">isIdentifierEscaped</a>().</p>


<h3 class="fn"><a name="isOpen" />bool QSqlDriver.isOpen (<i>self</i>)</h3><p>Returns true if the database connection is open; otherwise
returns false.</p>


<h3 class="fn"><a name="isOpenError" />bool QSqlDriver.isOpenError (<i>self</i>)</h3><p>Returns true if the there was an error opening the database
connection; otherwise returns false.</p>


<h3 class="fn"><a name="lastError" /><a href="qsqlerror.html">QSqlError</a> QSqlDriver.lastError (<i>self</i>)</h3><p>Returns a <a href="qsqlerror.html">QSqlError</a> object which
contains information about the last error that occurred on the
database.</p>
<p><b>See also</b> <a href="qsqldriver.html#setLastError">setLastError</a>().</p>


<h3 class="fn"><a name="numericalPrecisionPolicy" /><a href="qsql.html#NumericalPrecisionPolicy-enum">QSql.NumericalPrecisionPolicy</a> QSqlDriver.numericalPrecisionPolicy (<i>self</i>)</h3><p>Returns the current default precision policy for the database
connection.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qsql.html#NumericalPrecisionPolicy-enum">QSql.NumericalPrecisionPolicy</a>,
<a href="qsqldriver.html#setNumericalPrecisionPolicy">setNumericalPrecisionPolicy</a>(),
<a href="qsqlquery.html#numericalPrecisionPolicy">QSqlQuery.numericalPrecisionPolicy</a>(),
and <a href="qsqlquery.html#setNumericalPrecisionPolicy">QSqlQuery.setNumericalPrecisionPolicy</a>().</p>


<h3 class="fn"><a name="open" />bool QSqlDriver.open (<i>self</i>, QString&#160;<i>db</i>, QString&#160;<i>user</i>&#160;=&#160;QString(), QString&#160;<i>password</i>&#160;=&#160;QString(), QString&#160;<i>host</i>&#160;=&#160;QString(), int&#160;<i>port</i>&#160;=&#160;-1, QString&#160;<i>options</i>&#160;=&#160;QString())</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Derived classes must reimplement this pure virtual function to
open a database connection on database <i>db</i>, using user name
<i>user</i>, password <i>password</i>, host <i>host</i>, port
<i>port</i> and connection options <i>options</i>.</p>
<p>The function must return true on success and false on
failure.</p>
<p><b>See also</b> <a href="qsqldriver.html#setOpen">setOpen</a>().</p>


<h3 class="fn"><a name="primaryIndex" /><a href="qsqlindex.html">QSqlIndex</a> QSqlDriver.primaryIndex (<i>self</i>, QString&#160;<i>tableName</i>)</h3><p>Returns the primary index for table <i>tableName</i>. Returns an
empty <a href="qsqlindex.html">QSqlIndex</a> if the table doesn't
have a primary index. The default implementation returns an empty
index.</p>


<h3 class="fn"><a name="record" /><a href="qsqlrecord.html">QSqlRecord</a> QSqlDriver.record (<i>self</i>, QString&#160;<i>tableName</i>)</h3><p>Returns a <a href="qsqlrecord.html">QSqlRecord</a> populated
with the names of the fields in table <i>tableName</i>. If no such
table exists, an empty record is returned. The default
implementation returns an empty record.</p>


<h3 class="fn"><a name="rollbackTransaction" />bool QSqlDriver.rollbackTransaction (<i>self</i>)</h3><p>This function is called to rollback a transaction. If
successful, return true, otherwise return false. The default
implementation does nothing and returns false.</p>
<p><b>See also</b> <a href="qsqldriver.html#beginTransaction">beginTransaction</a>() and
<a href="qsqldriver.html#commitTransaction">commitTransaction</a>().</p>


<h3 class="fn"><a name="setLastError" />QSqlDriver.setLastError (<i>self</i>, <a href="qsqlerror.html">QSqlError</a>&#160;<i>e</i>)</h3><p>This function is used to set the value of the last error,
<i>error</i>, that occurred on the database.</p>
<p><b>See also</b> <a href="qsqldriver.html#lastError">lastError</a>().</p>


<h3 class="fn"><a name="setNumericalPrecisionPolicy" />QSqlDriver.setNumericalPrecisionPolicy (<i>self</i>, <a href="qsql.html#NumericalPrecisionPolicy-enum">QSql.NumericalPrecisionPolicy</a>&#160;<i>precisionPolicy</i>)</h3><p>Sets the default numerical precision policy used by queries
created by this driver to <i>precisionPolicy</i>.</p>
<p>Note: Setting the default precision policy to
<i>precisionPolicy</i> doesn't affect any currently active
queries.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qsql.html#NumericalPrecisionPolicy-enum">QSql.NumericalPrecisionPolicy</a>,
<a href="qsqldriver.html#numericalPrecisionPolicy">numericalPrecisionPolicy</a>(),
<a href="qsqlquery.html#setNumericalPrecisionPolicy">QSqlQuery.setNumericalPrecisionPolicy</a>(),
and <a href="qsqlquery.html#numericalPrecisionPolicy">QSqlQuery.numericalPrecisionPolicy</a>().</p>


<h3 class="fn"><a name="setOpen" />QSqlDriver.setOpen (<i>self</i>, bool&#160;<i>o</i>)</h3><p>This function sets the open state of the database to
<i>open</i>. Derived classes can use this function to report the
status of <a href="qsqldriver.html#open">open</a>().</p>
<p><b>See also</b> <a href="qsqldriver.html#open">open</a>() and
<a href="qsqldriver.html#setOpenError">setOpenError</a>().</p>


<h3 class="fn"><a name="setOpenError" />QSqlDriver.setOpenError (<i>self</i>, bool&#160;<i>e</i>)</h3><p>This function sets the open error state of the database to
<i>error</i>. Derived classes can use this function to report the
status of <a href="qsqldriver.html#open">open</a>(). Note that if
<i>error</i> is true the open state of the database is set to
closed (i.e., <a href="qsqldriver.html#isOpen">isOpen</a>() returns
false).</p>
<p><b>See also</b> <a href="qsqldriver.html#isOpenError">isOpenError</a>(), <a href="qsqldriver.html#open">open</a>(), and <a href="qsqldriver.html#setOpen">setOpen</a>().</p>


<h3 class="fn"><a name="sqlStatement" />QString QSqlDriver.sqlStatement (<i>self</i>, <a href="qsqldriver.html#StatementType-enum">StatementType</a>&#160;<i>type</i>, QString&#160;<i>tableName</i>, <a href="qsqlrecord.html">QSqlRecord</a>&#160;<i>rec</i>, bool&#160;<i>preparedStatement</i>)</h3><p>Returns a SQL statement of type <i>type</i> for the table
<i>tableName</i> with the values from <i>rec</i>. If
<i>preparedStatement</i> is true, the string will contain
placeholders instead of values.</p>
<p>This method can be used to manipulate tables without having to
worry about database-dependent SQL dialects. For non-prepared
statements, the values will be properly escaped.</p>


<h3 class="fn"><a name="stripDelimiters" />QString QSqlDriver.stripDelimiters (<i>self</i>, QString&#160;<i>identifier</i>, <a href="qsqldriver.html#IdentifierType-enum">IdentifierType</a>&#160;<i>type</i>)</h3><p>Returns the <i>identifier</i> with the leading and trailing
delimiters removed, <i>identifier</i> can either be a table name or
field name, dependent on <i>type</i>. If <i>identifier</i> does not
have leading and trailing delimiter characters, <i>identifier</i>
is returned without modification.</p>
<p><b>Warning:</b> Because of binary compatibility constraints,
this function is not virtual, If you want to provide your own
implementation in your <a href="qsqldriver.html">QSqlDriver</a>
subclass, reimplement the <a href="qsqldriver.html#stripDelimitersImplementation">stripDelimitersImplementation</a>()
slot in your subclass instead. The stripDelimiters() function will
dynamically detect the slot and call it.</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also</b> <a href="qsqldriver.html#isIdentifierEscaped">isIdentifierEscaped</a>().</p>


<h3 class="fn"><a name="stripDelimitersImplementation" />QString QSqlDriver.stripDelimitersImplementation (<i>self</i>, QString&#160;<i>identifier</i>, <a href="qsqldriver.html#IdentifierType-enum">IdentifierType</a>&#160;<i>type</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>QString stripDelimitersImplementation(const QString&amp;,QSqlDriver::IdentifierType) const</tt>.</p><p>This slot returns <i>identifier</i> with the leading and
trailing delimiters removed, <i>identifier</i> can either be a
tablename or field name, dependent on <i>type</i>. If
<i>identifier</i> does not have leading and trailing delimiter
characters, <i>identifier</i> is returned without modification.</p>
<p>Because of binary compatibility constraints, the <a href="qsqldriver.html#stripDelimiters">stripDelimiters</a>() function
(introduced in Qt 4.5) is not virtual. Instead, <a href="qsqldriver.html#stripDelimiters">stripDelimiters</a>() will
dynamically detect and call <i>this</i> slot. It generally
unnecessary to reimplement this slot.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qsqldriver.html#stripDelimiters">stripDelimiters</a>().</p>


<h3 class="fn"><a name="subscribedToNotifications" />QStringList QSqlDriver.subscribedToNotifications (<i>self</i>)</h3><p>Returns a list of the names of the event notifications that are
currently subscribed to.</p>
<p><b>Warning:</b> Because of binary compatibility constraints,
this function is not virtual. If you want to provide event
notification support in your own <a href="qsqldriver.html">QSqlDriver</a> subclass, reimplement the <a href="qsqldriver.html#subscribedToNotificationsImplementation">subscribedToNotificationsImplementation</a>()
slot in your subclass instead. The subscribedToNotifications()
function will dynamically detect the slot and call it.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qsqldriver.html#subscribeToNotification">subscribeToNotification</a>()
and <a href="qsqldriver.html#unsubscribeFromNotification">unsubscribeFromNotification</a>().</p>


<h3 class="fn"><a name="subscribedToNotificationsImplementation" />QStringList QSqlDriver.subscribedToNotificationsImplementation (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>QStringList subscribedToNotificationsImplementation() const</tt>.</p><p>Returns a list of the names of the event notifications that are
currently subscribed to.</p>
<p>Reimplement this slot to provide your own <a href="qsqldriver.html">QSqlDriver</a> subclass with event notification
support; because of binary compatibility constraints, the <a href="qsqldriver.html#subscribedToNotifications">subscribedToNotifications</a>()
function (introduced in Qt 4.4) is not virtual. Instead, <a href="qsqldriver.html#subscribedToNotifications">subscribedToNotifications</a>()
will dynamically detect and call <i>this</i> slot. The default
implementation simply returns an empty <a href="qstringlist.html">QStringList</a>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qsqldriver.html#subscribedToNotifications">subscribedToNotifications</a>().</p>


<h3 class="fn"><a name="subscribeToNotification" />bool QSqlDriver.subscribeToNotification (<i>self</i>, QString&#160;<i>name</i>)</h3><p>This function is called to subscribe to event notifications from
the database. <i>name</i> identifies the event notification.</p>
<p>If successful, return true, otherwise return false.</p>
<p>The database must be open when this function is called. When the
database is closed by calling <a href="qsqldriver.html#close">close</a>() all subscribed event
notifications are automatically unsubscribed. Note that calling
<a href="qsqldriver.html#open">open</a>() on an already open
database may implicitly cause <a href="qsqldriver.html#close">close</a>() to be called, which will cause
the driver to unsubscribe from all event notifications.</p>
<p>When an event notification identified by <i>name</i> is posted
by the database the <a href="qsqldriver.html#notification">notification</a>() signal is
emitted.</p>
<p><b>Warning:</b> Because of binary compatibility constraints,
this function is not virtual. If you want to provide event
notification support in your own <a href="qsqldriver.html">QSqlDriver</a> subclass, reimplement the <a href="qsqldriver.html#subscribeToNotificationImplementation">subscribeToNotificationImplementation</a>()
slot in your subclass instead. The subscribeToNotification()
function will dynamically detect the slot and call it.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qsqldriver.html#unsubscribeFromNotification">unsubscribeFromNotification</a>(),
<a href="qsqldriver.html#subscribedToNotifications">subscribedToNotifications</a>(),
and <a href="qsqldriver.html#hasFeature">QSqlDriver.hasFeature</a>().</p>


<h3 class="fn"><a name="subscribeToNotificationImplementation" />bool QSqlDriver.subscribeToNotificationImplementation (<i>self</i>, QString&#160;<i>name</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>bool subscribeToNotificationImplementation(const QString&amp;)</tt>.</p><p>This slot is called to subscribe to event notifications from the
database. <i>name</i> identifies the event notification.</p>
<p>If successful, return true, otherwise return false.</p>
<p>The database must be open when this <i>slot</i> is called. When
the database is closed by calling <a href="qsqldriver.html#close">close</a>() all subscribed event
notifications are automatically unsubscribed. Note that calling
<a href="qsqldriver.html#open">open</a>() on an already open
database may implicitly cause <a href="qsqldriver.html#close">close</a>() to be called, which will cause
the driver to unsubscribe from all event notifications.</p>
<p>When an event notification identified by <i>name</i> is posted
by the database the <a href="qsqldriver.html#notification">notification</a>() signal is
emitted.</p>
<p>Reimplement this slot to provide your own <a href="qsqldriver.html">QSqlDriver</a> subclass with event notification
support; because of binary compatibility constraints, the <a href="qsqldriver.html#subscribeToNotification">subscribeToNotification</a>()
function (introduced in Qt 4.4) is not virtual. Instead, <a href="qsqldriver.html#subscribeToNotification">subscribeToNotification</a>()
will dynamically detect and call <i>this</i> slot. The default
implementation does nothing and returns false.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qsqldriver.html#subscribeToNotification">subscribeToNotification</a>().</p>


<h3 class="fn"><a name="tables" />QStringList QSqlDriver.tables (<i>self</i>, <a href="qsql.html#TableType-enum">QSql.TableType</a>&#160;<i>tableType</i>)</h3><p>Returns a list of the names of the tables in the database. The
default implementation returns an empty list.</p>
<p>The <i>tableType</i> argument describes what types of tables
should be returned. Due to binary compatibility, the string
contains the value of the enum QSql.TableTypes as text. An empty
string should be treated as <a href="qsql.html#TableType-enum">QSql.Tables</a> for backward
compatibility.</p>


<h3 class="fn"><a name="unsubscribeFromNotification" />bool QSqlDriver.unsubscribeFromNotification (<i>self</i>, QString&#160;<i>name</i>)</h3><p>This function is called to unsubscribe from event notifications
from the database. <i>name</i> identifies the event
notification.</p>
<p>If successful, return true, otherwise return false.</p>
<p>The database must be open when this function is called. All
subscribed event notifications are automatically unsubscribed from
when the <a href="qsqldriver.html#close">close</a>() function is
called.</p>
<p>After calling <i>this</i> function the <a href="qsqldriver.html#notification">notification</a>() signal will no
longer be emitted when an event notification identified by
<i>name</i> is posted by the database.</p>
<p><b>Warning:</b> Because of binary compatibility constraints,
this function is not virtual. If you want to provide event
notification support in your own <a href="qsqldriver.html">QSqlDriver</a> subclass, reimplement the <a href="qsqldriver.html#unsubscribeFromNotificationImplementation">unsubscribeFromNotificationImplementation</a>()
slot in your subclass instead. The unsubscribeFromNotification()
function will dynamically detect the slot and call it.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qsqldriver.html#subscribeToNotification">subscribeToNotification</a>()
and <a href="qsqldriver.html#subscribedToNotifications">subscribedToNotifications</a>().</p>


<h3 class="fn"><a name="unsubscribeFromNotificationImplementation" />bool QSqlDriver.unsubscribeFromNotificationImplementation (<i>self</i>, QString&#160;<i>name</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>bool unsubscribeFromNotificationImplementation(const QString&amp;)</tt>.</p><p>This slot is called to unsubscribe from event notifications from
the database. <i>name</i> identifies the event notification.</p>
<p>If successful, return true, otherwise return false.</p>
<p>The database must be open when <i>this</i> slot is called. All
subscribed event notifications are automatically unsubscribed from
when the <a href="qsqldriver.html#close">close</a>() function is
called.</p>
<p>After calling <i>this</i> slot the <a href="qsqldriver.html#notification">notification</a>() signal will no
longer be emitted when an event notification identified by
<i>name</i> is posted by the database.</p>
<p>Reimplement this slot to provide your own <a href="qsqldriver.html">QSqlDriver</a> subclass with event notification
support; because of binary compatibility constraints, the <a href="qsqldriver.html#unsubscribeFromNotification">unsubscribeFromNotification</a>()
function (introduced in Qt 4.4) is not virtual. Instead, <a href="qsqldriver.html#unsubscribeFromNotification">unsubscribeFromNotification</a>()
will dynamically detect and call <i>this</i> slot. The default
implementation does nothing and returns false.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qsqldriver.html#unsubscribeFromNotification">unsubscribeFromNotification</a>().</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="notification" />void notification (const QString&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the database posts an event
notification that the driver subscribes to. <i>name</i> identifies
the event notification.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qsqldriver.html#subscribeToNotification">subscribeToNotification</a>().</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>